//
//  MXFoodPlanDateCell.m
//  HNBaseProject
//
//  Created by xujie on 2024/6/4.
//

#import "MXFoodPlanDateCell.h"

@implementation MXFoodPlanDateCell
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self createUI];
    }
    return self;
}

- (void)createUI {
    
    self.bgView = [[UIView alloc] init];
    self.bgView.backgroundColor = [UIColor colorWithHexString:@"#E2E2E2"];
    self.bgView.layer.cornerRadius = 6;
    self.bgView.layer.masksToBounds = YES;
    [self.contentView addSubview:self.bgView];
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.offset(0);
        make.height.mas_equalTo(49);
    }];
    
    self.selectBg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"food_plan_bg"]];
    [self.contentView addSubview:self.selectBg];
    [self.selectBg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.top.offset(0);
    }];
    self.selectBg.hidden = YES;
    
    self.dateLab = [[UILabel alloc] init];
    self.dateLab.textColor = [UIColor colorWithHexString:@"#000000"];
    self.dateLab.font = PFRFontMedium(14);
    [self.contentView addSubview:self.dateLab];
    [self.dateLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(10);
        make.centerX.mas_equalTo(self.contentView);
    }];
}

- (void)reloadCellWithSelect:(BOOL)select title:(nonnull NSString *)title {
    if (select) {
        self.bgView.hidden = YES;
        self.selectBg.hidden = NO;
        self.dateLab.textColor = UIColor.whiteColor;
    } else {
        self.bgView.hidden = NO;
        self.selectBg.hidden = YES;
        self.dateLab.textColor = [UIColor colorWithHexString:@"#000000"];
    }
    self.dateLab.text = title;
}
@end
